﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Sale.Api.Application.Command.SaleOrder;
using Sale.Domain;
using Sale.Dtos;
using Sale.ErrorCode;

namespace Sale.Api.Controllers
{
    /// <summary>
    /// 销售单控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    //[Authorize]
    public class SaleOrderController : ControllerBase
    {
        IMediator mediator;

        public SaleOrderController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 销售单显示接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<SaleOrderDTO>>> GetSaleOrder([FromQuery]GetSaleOrderCommand request)
        {
            return mediator.Send(request);
        }
    }
}
